package org.quickstart.client;

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import net.customware.gwt.dispatch.client.DispatchAsync;
import org.quickstart.api.action.GetContactsAction;
import org.quickstart.api.service.ContactsService;
import org.quickstart.api.service.ContactsServiceAsync;
import org.quickstart.client.gin.QuickStartInjector;
import org.quickstart.client.view.PhoneBookPresenter;
import org.quickstart.model.Contact;

import java.util.ArrayList;

/**
 * @author Yoav Aharoni
 */
public class AppEntryPoint implements EntryPoint {
	private final QuickStartInjector injector = GWT.create(QuickStartInjector.class);

	@Override
	public void onModuleLoad() {
		// Setup Display
		final PhoneBookPresenter presenter = injector.getPhoneBookPresenter();
		final Widget rootWidget = presenter.getDisplay().asWidget();
		RootPanel.get().add(rootWidget);
		presenter.bind();
		presenter.revealDisplay();
		injector.getPlaceManager().fireCurrentPlace();

		// Test logger
		Log.info("Test INFO message");
	}
}
